<?php
/**
 * Represents an Entity.
 *
 * @author Mark Dohmen.
 */
abstract class Entity {
	
	/**
 	 * The location on the map.
 	 */
	private $location;
	
	/**
	 * If we are interacting, then who's the lucky bastard?
	 */
	private $interactingEntity = NULL;
	
	/**
 	 * Sets the current location of this entity.
	 *
	 * @param $location
 	 */
	final public function setLocation(Location $location) {
		$this->location = $location;
	}
	
	/**
 	 * Gets the current location of this Entity.
	 *
	 * @return $location/null
 	 */
	final public function getLocation() {
		if ($location instanceof Location) {
			return (object) $location;	
		}
		return NULL;
	}
	
	/**
 	 * Gets this entity's interacting status.
	 *
	 * @param $isInteracting
 	 */
	final public function getIsInteracting() {
		return (boolean) $this->interactingEntity === NULL ? true : false;
	}
	
	/**
	 * Sets the interacting entity.
	 *
	 * @param $entity
	 */
	final public function setInteractingEntity(Entity $entity = NULL) {
		$this->interactingEntity = $entity;
	}
	
	/**
	 * Gets the interacting entity.
	 *
	 * @return $interactingEntity/null
	 */
	final public function getInteractingEntity() {
		if ($this->interactingEntity instanceof Entity) {
			return (object) $this->interactingEntity;
		}
		return NULL;
	}
}
?>